Skip to content

Remove enabling of DeprecationWarning for anyone who imports the library#1127

Open
gideonred wants to merge 7 commits into
rasbt:masterfrom
gideonred:master
Open

Remove enabling of DeprecationWarning for anyone who imports the library#1127
gideonred wants to merge 7 commits into
rasbt:masterfrom
gideonred:master

Conversation

@gideonred

@gideonred gideonred commented Jul 11, 2025

Copy link
Copy Markdown

Description

At my current company someone imported this library.

Due to the library enabling all DeprecationWarnings on for all of code (including outside of this library), it causes a large increase in logs. Which impacts performance and cost of Observability tooling.

This PR disables that.

Pull Request Checklist

  • Added a note about the modification or contribution to the ./docs/sources/CHANGELOG.md file (if applicable)
  • Added appropriate unit test functions in the ./mlxtend/*/tests directories (if applicable)
  • Modify documentation in the corresponding Jupyter Notebook under mlxtend/docs/sources/ (if applicable)
  • Ran PYTHONPATH='.' pytest ./mlxtend -sv and make sure that all unit tests pass (for small modifications, it might be sufficient to only run the specific test file, e.g., PYTHONPATH='.' pytest ./mlxtend/classifier/tests/test_stacking_cv_classifier.py -sv)
  • Checked for style issues by running flake8 ./mlxtend

Comment thread mlxtend/frequent_patterns/fpcommon.py
gideonred and others added 4 commits June 5, 2026 13:55
Co-authored-by: Paolo Melchiorre <pmelchiorre@rippling.com>
Add blank line after imports before the warnings.filterwarnings call so
isort (profile black) passes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
scikit-learn 1.9 incorporates sample_weight into RandomForest's bootstrap
resampling, so sample_weight=np.ones(...) is no longer numerically identical
to sample_weight=None. Set bootstrap=False in the three classifier
test_sample_weight tests to restore that invariant (uniform weights == no
weights) while still exercising that real weights change predictions.

test_fit_params pinned exact RandomForest CV scores that drift across sklearn
versions; relax it to assert the deterministic subset structure and a
tolerance band on the scores instead of exact floats.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@pauloxnet

Copy link
Copy Markdown

Thank you @gideonred for updating the PR along the lines we discussed on fpcommon.py; the scoped warnings.filterwarnings(..., module=...) approach is exactly what I had in mind for keeping host applications quiet while still surfacing deprecations inside mlxtend.

One more small thing would help @rasbt when he gets to this PR: could you add a brief line under docs/sources/CHANGELOG.md describing the user-visible warning behavior change? The contributor checklist in docs/sources/CONTRIBUTING.md explicitly asks for a changelog note for modifications, and having it in the PR up front usually makes maintainer review faster because the “what changed for users” story is already in the standard place.

Thanks again for the work here.

@gideonred

Copy link
Copy Markdown
Author

@pauloxnet docs/sources/CHANGELOG.md updated, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants